import request from '../utils/request'
import type { ApiResponse, LoginParams, UserInfo } from '../types/api'

// 用户登录
export function login(data: LoginParams) {
  return request<ApiResponse<{ token: string }>>({
    url: '/user/login',
    method: 'post',
    data
  })
}

// 获取用户信息
export function getUserInfo() {
  return request({
    url: '/addons/shop/api.user/index',
    method: 'get'
  })
}

// 用户登出
export function logout() {
  return request<ApiResponse>({
    url: '/user/logout',
    method: 'post'
  })
}

// 修改用户信息
export function updateUserInfo(data: Partial<UserInfo>) {
  return request<ApiResponse>({
    url: '/user/update',
    method: 'put',
    data
  })
} 